Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Add comments as part of the snippets for consistency #2735

Merged
merged 7 commits into from
Aug 15, 2023

Conversation

ElinorW
Copy link
Contributor

@ElinorW ElinorW commented Aug 9, 2023

Overview

Fixes #2689

Demo

Before
image

After
image

Notes

Optional. Ancillary topics, caveats, alternative strategies that didn't work out, anything else.

Testing Instructions

  • Check out this branch and run GE locally
  • Navigate to the code snippets tab
  • Select each snippet
  • Observe comments are now part of the code and not separate

@ElinorW ElinorW requested a review from a team as a code owner August 9, 2023 14:07
@Onokaev
Copy link
Contributor

Onokaev commented Aug 14, 2023

Nit:
To fix the php tag appearing twice on the editor, we can do this:

const constructBody = () => {
    if(language === 'php'){
      return snippet.replace(/<\?php/g, `<?php\n${addExtraSnippetInformation()}`)
    }
    return addExtraSnippetInformation() + snippet;
  }

Then pass this function to the body property of the editor like so:

<Monaco
            body={constructBody()}
            language={language}
            readOnly={true}
            height={height}
  />

Then you can remove the check for the php language in the addExtraSnippetInformation function

@Onokaev Onokaev merged commit fdc4792 into dev Aug 15, 2023
@Onokaev Onokaev deleted the fix/snippet-comment branch August 15, 2023 12:24
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consistent comments for the SDK snippets tab
2 participants